<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5shiv.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="lib/layui-v2.5.6/layui/css/layui.css"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>订单管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 订单管理 <span
        class="c-gray en">&gt;</span> 订单列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
                                              href="javascript:location.replace(location.href);" title="刷新"><i
        class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="text-c">
        <button onclick="removeIframe()" class="btn btn-primary radius">关闭选项卡</button>
        <span class="select-box inline">
		<select name="" class="select">
			<option value="0">全部分类</option>
			<option value="1">分类一</option>
			<option value="2">分类二</option>
		</select>
		</span> 日期范围：
        <input type="text" onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'logmax\')||\'%y-%M-%d\'}' })" id="logmin"
               class="input-text Wdate" style="width:120px;">
        -
        <input type="text" onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'logmin\')}',maxDate:'%y-%M-%d' })" id="logmax"
               class="input-text Wdate" style="width:120px;">
        <input type="text" name="" id="" placeholder=" 资讯名称" style="width:250px" class="input-text">
        <button name="" id="textSearch" class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i> 搜资讯
        </button>
    </div>
    <div class="mt-20">
        <table id="order-list" lay-filter="order-list-filter"></table>
    </div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="lib/layui-v2.5.6/layui/layui.js"></script>
<script type="text/html" id="order-list-toolbar">
    <div class="layuibtn-container">
        <button class="layui-btn layui-btn-sm" lay-event="add">添加</button>
        <button class="layui-btn layui-btn-sm" lay-event="delete">删除</button>
    </div>
</script>
<script>
    var tableId;
    var layer;
    layui.use(['table', 'layer'], function () {
        var table = layui.table;
        layer = layui.layer;
        tableId = table.render({
            elem: '#order-list'
            , url: '/Olala/orderMaster/page' //数据接口
            , page: true //开启分页
            , toolbar: '#order-list-toolbar'
            , method: 'post'
            , response: {
                statusCode: 20 //规定成功的状态码，默认：0
            }
            , cols:
                [
                    [ //表头
                        {field: "checkbox", title: "选择", type: "checkbox", width: "5%"},
                        {field: "orderId", title: "ID", width: "5%"},
                        {
                            field: "orderSn", title: "订单编号", width: "20%",
                            templet: function (data) {
                                return "<a href='javascript:void(0)' onclick='orderDetailBox(" + data.orderId + ")'>" + data.orderSn + "</a>"
                            }
                        },
                        {field: "transationNo", title: "交易流水号", width: "10%"},
                        {field: "customerId", title: "客户编号", width: "10%"},
                        {
                            field: "payType", title: "支付方式", width: "6%",
                            templet: function (data) {
                                switch (data.payType) {
                                    case 1:
                                        return "现金";
                                    case 2:
                                        return "余额";
                                    case 3:
                                        return "网银";
                                    case 4:
                                        return "支付宝";
                                    case 5:
                                        return "微信";
                                }
                            }
                        },
                        {field: "payTime", title: "支付时间", width: "10%"},
                        {field: "payMoney", title: "支付金额", width: "7%"},
                        {field: "createTime", title: "下单时间", width: "12%"},
                        {
                            field: "orderStatus", title: "订单状态", width: "10%",
                            templet: function (data) {
                                switch (data.orderStatus) {
                                    case 0:
                                        return "未支付";
                                    case 1:
                                        return "已支付";
                                    case 2:
                                        return "已完成";
                                    case 3:
                                        return "待退款";
                                    case 4:
                                        return "已退款";
                                    case 5:
                                        return "已关闭";
                                }
                            }
                        },
                        {
                            title: "操作", width: "6%",
                            templet: function () {
                                return "<button class=\"layui-btn layui-btn-sm\" lay-event=\"delete\">删除</button>";
                            }
                        }
                    ]
                ]
        });
    });

    function orderDetailBox(id) {
        localStorage.setItem("order_id", id);
        var index = layer.open({
            type: 2,
            title: '订单详情',
            content: '/Olala/server/order-detail-list.html',
            end: function () {
                localStorage.removeItem("order_id")
                tableId.reload();
            }
        });
        layer.full(index);
    }

</script>
</body>
</html>